layui.define(['jquery'], function (exports) {
    var $ = layui.jquery;
    var DEFAULT_OPTIONS = {
        url: "",
        type: "post",
        dataType: "json",
        data: "",
        success: function () {

        }
    }
    var setting = {};
    var ajax = {
        /**
         * 获取被调用函数的方法名称
         * @param callmethod
         * @returns {Array|{index: number, input: string}}
         */
        getJSON: function (options) {
            $.extend(true, setting, DEFAULT_OPTIONS, options);
            if (setting.url) {
                return $.ajax(setting);
            }else{
                console.error("url is not to be defined")
            }
        }
    }
    exports('ajax', ajax);
})